package api;

import java.util.Scanner;

/**
 * @Author admin
 * @Date 2019/3/27 9:18
 */
public class 大串中小串出现的次数 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String maxString="woaijavawozhenaijavawozhendeaijavawozhendehenaijava";
        String minString="java";
        System.out.println("java在大串中出现的次数"+getcount(maxString,minString));

    }
    public static int getcount(String max,String min){
        int count=0;
        int index = max.indexOf(min);
        while (index!=-1){
            count++;
            max = max.substring(index+min.length());
            index=max.indexOf(min);
        }
        return count;
    }
}
